<?php
require_once('db.php');
class Admin{
  public function adLogin($username,$password){
    $conn=getConn();
    $sql="select * from admin where username='".$username."'";
    $result=mysqli_query($conn,$sql);
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        if($row['password']==$password){
          Session_start();
          $_SESSION['username']=$username;
          $_SESSION['userId']=$row['id'];
          $_SESSION['adLoginFlag']=true;
          mysqli_close($conn);
          return true;
        }else{
          mysqli_close($conn);
          return false;
        }
    }
  }
  public function adLoginOut(){
    Session_start();
    session_destroy(); 
  }
  
}


?>